package ls.vuecp.gui.view;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.geom.Point2D;

import javax.swing.JViewport;

import tufts.vue.VueConstants;

public class MapViewport extends JViewport
	implements VueConstants
{

	public MapViewport(javax.swing.JScrollPane scrollPane) {
//      if (viewer == null)
//          throw new NullPointerException("viewer is null");
//      this.viewer = viewer;
     this.scrollPane = scrollPane;
 }
	
	private /*final*/ MapViewer viewer; // should be final, but can't due to JScrollPane init code
    private final javax.swing.JScrollPane scrollPane;

    //private Rectangle2D lastMapBounds = new Rectangle2D.Float();
    private Dimension lastCanvas = new Dimension();
    private Point2D lastMapLocationAtCanvasOrigin = new Point2D.Float();
    
    @Override
    public void setView(Component view) {
        viewer = (MapViewer) view;
//         if (view != viewer)
//             throw new Error("view != viewer; " + view + " != " + viewer);
        super.setView(view);
    }
}
